home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / bok-bndr.hqx / Bookbinder / background_4755.txt < prev    next >
Text File  |  1991-06-04  |  18KB  |  772 lines

  1. -- background: 4755 from stack: in
  2. -- bmap block id: 3717
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: page
  6. ----- HyperTalk script -----
  7. on openCard
  8.   updateBookmarks (the number of this card)
  9.   send showBookmarks
  10.   send showFootnotes
  11.   pass openCard
  12. end openCard
  13.  
  14. on showBookmarks
  15.   global bookmark1
  16.   global bookmark2
  17.   get the id of this card
  18.   if it is bookmark1 or it is bookmark2 then
  19.     show background button "mark"
  20.   else
  21.     hide background button "mark"
  22.   end if
  23. end showBookmarks
  24.  
  25. on showFootnotes
  26.   get field "footnote1"
  27.   if it is not "" then
  28.     show field "footnote1"
  29.   else
  30.     hide field "footnote1"
  31.   end if
  32.   get field "footnote2"
  33.   if it is not "" then
  34.     show field "footnote2"
  35.   else
  36.     hide field "footnote2"
  37.   end if
  38. end showFootnotes
  39.  
  40. on arrowKey choice
  41.   put false into dontScroll
  42.   if visible of background button "Done Changes" is true then
  43.     beep
  44.     put true into dontScroll
  45.   end if
  46.   if (the name of this card is the name of card "index") or (the name of this card is the name of card "contents") then
  47.     if visible of card button "Done Changes" is true then
  48.       beep
  49.       put true into dontScroll
  50.     end if
  51.   end if
  52.   if dontScroll is false then
  53.     if choice is "left" then
  54.       visual scroll right
  55.     else
  56.       visual scroll left
  57.     end if
  58.     pass arrowKey
  59.   end if
  60. end arrowKey
  61.  
  62. on updatePageNumbers
  63.   set cursor to watch
  64.   put the number of card "contents" into presentCard
  65.   repeat for the number of cards in this background
  66.     put presentCard into field "page no" of card presentCard
  67.     updateFootnotes presentCard
  68.     add 1 to presentCard
  69.   end repeat
  70. end updatePageNumbers
  71.  
  72. on updateFootnotes presentCard
  73.   global deletedCard
  74.   get line 1 of field "topic" of card presentCard
  75.   put it into field "footnote1" of card presentCard
  76.   if it is not "" then
  77.     get line 1 of field "card id" of card presentCard
  78.     if it is not "" then
  79.       if it is word 3 of deletedCard then
  80.         put "" into line 1 of field "card id" of card presentCard
  81.       else
  82.         get the number of card id it
  83.         put " - p" & it after field "footnote1" of card presentCard
  84.       end if
  85.     end if
  86.   end if
  87.   get line 2 of field "topic" of card presentCard
  88.   put it into field "footnote2" of card presentCard
  89.   if it is not "" then
  90.     get line 2 of field "card id" of card presentCard
  91.     if it is not "" then
  92.       if it is word 3 of deletedCard then
  93.         put "" into line 2 of field "card id" of card presentCard
  94.       else
  95.         get the number of card id it
  96.         put " - p" & it after field "footnote2" of card presentCard
  97.       end if
  98.     end if
  99.   end if
  100. end updateFootnotes
  101.  
  102. on updateBookmarks presentCard
  103.   global deletedCard
  104.   global bookmark1
  105.   global bookmark2
  106.   if bookmark1 is not 0 then
  107.     if bookmark1 is deletedCard then
  108.       put 0 into bookmark1
  109.       hide background button "bookmark1"
  110.       hide field "bookmark1"
  111.       put "" into field "bookmark1" of card presentCard
  112.     else
  113.       get number of bookmark1
  114.       put "p" & it into field "bookmark1" of card presentCard
  115.     end if
  116.   else
  117.     put "" into field "bookmark1" of card presentCard
  118.   end if
  119.   if bookmark2 is not 0 then
  120.     if bookmark2 is deletedCard then
  121.       put 0 into bookmark2
  122.       hide background button "bookmark2"
  123.       hide field "bookmark2"
  124.       put "" into field "bookmark2" of card presentCard
  125.     else
  126.       get number of bookmark2
  127.       put "p" & it into field "bookmark2" of card presentCard
  128.     end if
  129.   else
  130.     put "" into field "bookmark2" of card presentCard
  131.   end if
  132. end updateBookmarks
  133.  
  134. on idle
  135.   global cardJustPasted
  136.   global cardJustDeleted
  137.   global deletedCard
  138.   global stackJustPrinted
  139.   if stackJustPrinted then
  140.     put false into stackJustPrinted
  141.     send showFootnotes
  142.     pop card
  143.   else
  144.     if cardJustDeleted then
  145.       put false into cardJustDeleted
  146.       updateBookmarks (the number of this card)
  147.       send showBookmarks
  148.       send showFootnotes
  149.     else
  150.       if cardJustPasted then
  151.         put false into cardJustPasted
  152.         set lockScreen to true
  153.         push card
  154.         go card "contents"
  155.         get the id of this background
  156.         pop card
  157.         set lockScreen to false
  158.         if it is not the id of this background then
  159.           -- i.e. this is not a true "page" card
  160.           answer "Background has changed; delete this card!" with "OK"
  161.         else
  162.           if the id of this card is deletedCard then
  163.             put "" into deletedCard
  164.           end if
  165.         end if
  166.       end if
  167.     end if
  168.   end if
  169.   pass idle
  170. end idle
  171.  
  172. on openBackground
  173.   global xrefdepth
  174.   if xrefdepth is 0 then
  175.     hide background button "return"
  176.   end if
  177. end openBackground
  178.  
  179.  
  180.  
  181. -- part 1 (button)
  182. -- low flags: 00
  183. -- high flags: 0000
  184. -- rect: left=424 top=314 right=337 bottom=453
  185. -- title width / last selected line: 0
  186. -- icon id / first selected line: 1014 / 1014
  187. -- text alignment: 1
  188. -- font id: 0
  189. -- text size: 12
  190. -- style flags: 0
  191. -- line height: 16
  192. -- part name: 
  193. ----- HyperTalk script -----
  194. on mouseDown
  195.   global alreadyPaged
  196.   put false into alreadyPaged
  197.   pass mouseDown
  198. end mouseDown
  199.  
  200. on mouseStillDown
  201.   global alreadyPaged
  202.   wait 10
  203.   visual effect scroll right
  204.   put true into alreadyPaged
  205.   go to previous card
  206. end mouseStillDown
  207.  
  208. on mouseUp
  209.   global alreadyPaged
  210.   if alreadyPaged is false then
  211.     visual effect scroll right
  212.     go to previous card
  213.   end if
  214. end mouseUp
  215.  
  216.  
  217.  
  218. -- part 2 (button)
  219. -- low flags: 00
  220. -- high flags: 0000
  221. -- rect: left=480 top=314 right=337 bottom=508
  222. -- title width / last selected line: 0
  223. -- icon id / first selected line: 1013 / 1013
  224. -- text alignment: 1
  225. -- font id: 0
  226. -- text size: 12
  227. -- style flags: 0
  228. -- line height: 16
  229. -- part name: 
  230. ----- HyperTalk script -----
  231. on mouseDown
  232.   global alreadyPaged
  233.   put false into alreadyPaged
  234.   pass mouseDown
  235. end mouseDown
  236.  
  237. on mouseStillDown
  238.   global alreadyPaged
  239.   wait 10
  240.   visual effect scroll left
  241.   put true into alreadyPaged
  242.   go to next card
  243. end mouseStillDown
  244.  
  245. on mouseUp
  246.   global alreadyPaged
  247.   if alreadyPaged is false then
  248.     visual effect scroll left
  249.     go to next card
  250.   end if
  251. end mouseUp
  252.  
  253.  
  254.  
  255. -- part 3 (button)
  256. -- low flags: 80
  257. -- high flags: 0000
  258. -- rect: left=400 top=316 right=339 bottom=427
  259. -- title width / last selected line: 0
  260. -- icon id / first selected line: 1012 / 1012
  261. -- text alignment: 1
  262. -- font id: 0
  263. -- text size: 12
  264. -- style flags: 0
  265. -- line height: 16
  266. -- part name: return
  267. ----- HyperTalk script -----
  268. on mouseUp
  269.   global xrefdepth
  270.   subtract 1 from xrefdepth
  271.   if xrefdepth = 0 then
  272.     hide background button "return"
  273.   end if
  274.   visual effect iris close
  275.   pop card
  276. end mouseUp
  277.  
  278.  
  279.  
  280. -- part 4 (field)
  281. -- low flags: 01
  282. -- high flags: 0000
  283. -- rect: left=14 top=60 right=300 bottom=494
  284. -- title width / last selected line: 0
  285. -- icon id / first selected line: 0 / 0
  286. -- text alignment: 0
  287. -- font id: 2
  288. -- text size: 10
  289. -- style flags: 0
  290. -- line height: 13
  291. -- part name: text
  292.  
  293.  
  294. -- part 6 (field)
  295. -- low flags: 01
  296. -- high flags: 0000
  297. -- rect: left=14 top=29 right=57 bottom=328
  298. -- title width / last selected line: 0
  299. -- icon id / first selected line: 0 / 0
  300. -- text alignment: 0
  301. -- font id: 2
  302. -- text size: 18
  303. -- style flags: 0
  304. -- line height: 24
  305. -- part name: heading
  306. ----- HyperTalk script -----
  307. on closeField
  308.   if cardInContents() then
  309.     put the userLevel into currentLevel
  310.     set the userLevel to 5
  311.     set lockScreen to true
  312.     doMenu "New Field"
  313.     put the number of card fields into numFields
  314.     choose browse tool
  315.     set the style of card field numFields to shadow
  316.     put "Updating Table of Contents." & numToChar(13) & "Please wait..." into card field numFields
  317.     set lockScreen to false
  318.     send updateContents to card "contents"
  319.     set lockScreen to true
  320.     choose field tool
  321.     click at the loc of card field numFields
  322.     doMenu "Clear Field"
  323.     choose browse tool
  324.     set lockScreen to false
  325.     set the userLevel to currentLevel
  326.   end if
  327.   pass closeField
  328. end closeField
  329.  
  330. function cardInContents
  331. set the cursor to watch
  332. get word 3 of the id of this card
  333. put false into inContents
  334. repeat with x = 1 to the number of lines in card field "content list" of card "contents"
  335.   if (line x of card field "content list" of card "contents") is it then
  336.     put true into inContents
  337.   end if
  338. end repeat
  339. return inContents
  340. end cardInContents
  341.  
  342.  
  343.  
  344.  
  345. -- part 7 (field)
  346. -- low flags: 01
  347. -- high flags: 0000
  348. -- rect: left=461 top=33 right=51 bottom=494
  349. -- title width / last selected line: 0
  350. -- icon id / first selected line: 0 / 0
  351. -- text alignment: 65535
  352. -- font id: 2
  353. -- text size: 10
  354. -- style flags: 0
  355. -- line height: 13
  356. -- part name: page no
  357.  
  358.  
  359. -- part 8 (button)
  360. -- low flags: 00
  361. -- high flags: 0000
  362. -- rect: left=8 top=311 right=334 bottom=39
  363. -- title width / last selected line: 0
  364. -- icon id / first selected line: 13081 / 13081
  365. -- text alignment: 1
  366. -- font id: 0
  367. -- text size: 12
  368. -- style flags: 0
  369. -- line height: 16
  370. -- part name: Contents
  371. ----- HyperTalk script -----
  372. on mouseUp
  373.   visual iris close
  374.   go card "contents"
  375. end mouseUp
  376.  
  377.  
  378.  
  379. -- part 9 (button)
  380. -- low flags: 00
  381. -- high flags: 0000
  382. -- rect: left=453 top=313 right=338 bottom=480
  383. -- title width / last selected line: 0
  384. -- icon id / first selected line: 0 / 0
  385. -- text alignment: 1
  386. -- font id: 0
  387. -- text size: 12
  388. -- style flags: 0
  389. -- line height: 16
  390. -- part name: book
  391. ----- HyperTalk script -----
  392. on mouseUp
  393.   -- Actually, to be really consistent we should update the bookmarks
  394.   -- of ALL pages here, so that when you Print Report they are all
  395.   -- correct.  However, this would slow things down for the reader.
  396.   global bookmark1
  397.   global bookmark2
  398.   get the id of this card
  399.   if bookmark1 = 0 then
  400.     put it into bookmark1
  401.     updateBookmarks (the number of this card)
  402.     show background button "bookmark1"
  403.     show field "bookmark1"
  404.     send showBookmarks
  405.   else
  406.     if bookmark2 = 0 then
  407.       put it into bookmark2
  408.       updateBookmarks (the number of this card)
  409.       show background button "bookmark2"
  410.       show field "bookmark2"
  411.       send showBookmarks
  412.     else
  413.       answer "Out of bookmarks!" with "OK"
  414.     end if
  415.   end if
  416. end mouseUp
  417.  
  418.  
  419.  
  420.  
  421. -- part 11 (button)
  422. -- low flags: 80
  423. -- high flags: 0000
  424. -- rect: left=451 top=313 right=338 bottom=476
  425. -- title width / last selected line: 0
  426. -- icon id / first selected line: 18951 / 18951
  427. -- text alignment: 1
  428. -- font id: 0
  429. -- text size: 12
  430. -- style flags: 0
  431. -- line height: 16
  432. -- part name: mark
  433. ----- HyperTalk script -----
  434. on mouseUp
  435.   global bookmark1
  436.   global bookmark2
  437.   get the id of this card
  438.   if it is bookmark1 then
  439.     put 0 into bookmark1
  440.     hide background button "bookmark1"
  441.     hide field "bookmark1"
  442.   end if
  443.   if it is bookmark2 then
  444.     put 0 into bookmark2
  445.     hide background button "bookmark2"
  446.     hide field "bookmark2"
  447.   end if
  448.   updateBookmarks (the number of this card)
  449.   send showBookmarks
  450. end mouseUp
  451.  
  452.  
  453.  
  454. -- part 17 (field)
  455. -- low flags: 01
  456. -- high flags: 0002
  457. -- rect: left=367 top=326 right=340 bottom=394
  458. -- title width / last selected line: 0
  459. -- icon id / first selected line: 0 / 0
  460. -- text alignment: 1
  461. -- font id: 4
  462. -- text size: 9
  463. -- style flags: 0
  464. -- line height: 12
  465. -- part name: bookmark1
  466.  
  467.  
  468. -- part 18 (field)
  469. -- low flags: 81
  470. -- high flags: 0002
  471. -- rect: left=337 top=326 right=340 bottom=364
  472. -- title width / last selected line: 0
  473. -- icon id / first selected line: 0 / 0
  474. -- text alignment: 1
  475. -- font id: 4
  476. -- text size: 9
  477. -- style flags: 0
  478. -- line height: 12
  479. -- part name: bookmark2
  480.  
  481.  
  482. -- part 13 (button)
  483. -- low flags: 80
  484. -- high flags: 0000
  485. -- rect: left=336 top=300 right=339 bottom=362
  486. -- title width / last selected line: 0
  487. -- icon id / first selected line: 6179 / 6179
  488. -- text alignment: 1
  489. -- font id: 0
  490. -- text size: 12
  491. -- style flags: 0
  492. -- line height: 16
  493. -- part name: bookmark2
  494. ----- HyperTalk script -----
  495. on mouseUp
  496.   global bookmark1
  497.   global bookmark2
  498.   if the id of this card is not bookmark2 then
  499.     if (the name of this card is not the name of card "contents") and (the id of this card is not bookmark1) then
  500.       global xrefdepth
  501.       add 1 to xrefdepth
  502.       push card
  503.       show background button "return"
  504.     end if
  505.     visual effect iris open
  506.     go bookmark2
  507.   end if
  508. end mouseUp
  509.  
  510.  
  511.  
  512. -- part 12 (button)
  513. -- low flags: 00
  514. -- high flags: 0000
  515. -- rect: left=366 top=300 right=339 bottom=392
  516. -- title width / last selected line: 0
  517. -- icon id / first selected line: 6179 / 6179
  518. -- text alignment: 1
  519. -- font id: 0
  520. -- text size: 12
  521. -- style flags: 0
  522. -- line height: 16
  523. -- part name: bookmark1
  524. ----- HyperTalk script -----
  525. on mouseUp
  526.   global bookmark1
  527.   global bookmark2
  528.   if the id of this card is not bookmark1 then
  529.     if (the name of this card is not the name of card "contents") and (the id of this card is not bookmark2) then
  530.       global xrefdepth
  531.       add 1 to xrefdepth
  532.       push card
  533.       show background button "return"
  534.     end if
  535.     visual effect iris open
  536.     go bookmark1
  537.   end if
  538. end mouseUp
  539.  
  540.  
  541.  
  542. -- part 20 (field)
  543. -- low flags: 81
  544. -- high flags: 0002
  545. -- rect: left=54 top=309 right=324 bottom=321
  546. -- title width / last selected line: 0
  547. -- icon id / first selected line: 0 / 0
  548. -- text alignment: 0
  549. -- font id: 2
  550. -- text size: 10
  551. -- style flags: 0
  552. -- line height: 13
  553. -- part name: footnote1
  554. ----- HyperTalk script -----
  555. on mouseUp
  556.   get line 1 of field "card id"
  557.   if it is not "" then
  558.     global xrefdepth
  559.     add 1 to xrefdepth
  560.     push card
  561.     show background button "return"
  562.     visual iris open
  563.     get last word of me
  564.     put "" into first char of it
  565.     go card it
  566.   end if
  567. end mouseUp
  568.  
  569.  
  570.  
  571. -- part 23 (field)
  572. -- low flags: 81
  573. -- high flags: 0002
  574. -- rect: left=54 top=325 right=340 bottom=321
  575. -- title width / last selected line: 0
  576. -- icon id / first selected line: 0 / 0
  577. -- text alignment: 0
  578. -- font id: 2
  579. -- text size: 10
  580. -- style flags: 0
  581. -- line height: 13
  582. -- part name: footnote2
  583. ----- HyperTalk script -----
  584. on mouseUp
  585.   get line 2 of field "card id"
  586.   if it is not "" then
  587.     global xrefdepth
  588.     add 1 to xrefdepth
  589.     push card
  590.     show background button "return"
  591.     visual iris open
  592.     get last word of me
  593.     put "" into first char of it
  594.     go card it
  595.   end if
  596. end mouseUp
  597.  
  598.  
  599.  
  600. -- part 30 (button)
  601. -- low flags: 80
  602. -- high flags: 0000
  603. -- rect: left=1 top=21 right=340 bottom=510
  604. -- title width / last selected line: 0
  605. -- icon id / first selected line: 0 / 0
  606. -- text alignment: 1
  607. -- font id: 0
  608. -- text size: 12
  609. -- style flags: 0
  610. -- line height: 16
  611. -- part name: beep
  612. ----- HyperTalk script -----
  613. on mouseUp
  614.   beep
  615. end mouseUp
  616.  
  617.  
  618.  
  619. -- part 26 (button)
  620. -- low flags: 80
  621. -- high flags: A003
  622. -- rect: left=367 top=26 right=43 bottom=470
  623. -- title width / last selected line: 0
  624. -- icon id / first selected line: 0 / 0
  625. -- text alignment: 1
  626. -- font id: 0
  627. -- text size: 12
  628. -- style flags: 0
  629. -- line height: 16
  630. -- part name: Done Changes
  631. ----- HyperTalk script -----
  632. on mouseUp
  633.   hide background button "beep"
  634.   hide background button "Topic"
  635.   hide background button "Card ID (optional)"
  636.   hide field "topic"
  637.   hide field "card id"
  638.   hide background button "Done Changes"
  639.   show background button "Add Footnote"
  640.   updateFootnotes (the number of this card)
  641.   send showFootnotes
  642. end mouseUp
  643.  
  644.  
  645.  
  646. -- part 25 (button)
  647. -- low flags: 00
  648. -- high flags: A003
  649. -- rect: left=366 top=26 right=43 bottom=467
  650. -- title width / last selected line: 0
  651. -- icon id / first selected line: 0 / 0
  652. -- text alignment: 1
  653. -- font id: 0
  654. -- text size: 12
  655. -- style flags: 0
  656. -- line height: 16
  657. -- part name: Add Footnote
  658. ----- HyperTalk script -----
  659. on mouseUp
  660.   show background button "beep"
  661.   show background button "Topic"
  662.   show background button "Card ID (optional)"
  663.   show field "topic"
  664.   show field "card id"
  665.   hide background button "Add Footnote"
  666.   show background button "Done Changes"
  667. end mouseUp
  668.  
  669.  
  670.  
  671. -- part 28 (button)
  672. -- low flags: 80
  673. -- high flags: 8002
  674. -- rect: left=51 top=111 right=133 bottom=318
  675. -- title width / last selected line: 0
  676. -- icon id / first selected line: 0 / 0
  677. -- text alignment: 1
  678. -- font id: 0
  679. -- text size: 12
  680. -- style flags: 0
  681. -- line height: 16
  682. -- part name: Topic
  683.  
  684.  
  685. -- part 31 (button)
  686. -- low flags: 80
  687. -- high flags: 8002
  688. -- rect: left=317 top=111 right=133 bottom=448
  689. -- title width / last selected line: 0
  690. -- icon id / first selected line: 0 / 0
  691. -- text alignment: 1
  692. -- font id: 0
  693. -- text size: 12
  694. -- style flags: 0
  695. -- line height: 16
  696. -- part name: Card ID (optional)
  697.  
  698.  
  699. -- part 27 (field)
  700. -- low flags: 80
  701. -- high flags: 0002
  702. -- rect: left=51 top=132 right=162 bottom=318
  703. -- title width / last selected line: 0
  704. -- icon id / first selected line: 0 / 0
  705. -- text alignment: 0
  706. -- font id: 4
  707. -- text size: 9
  708. -- style flags: 0
  709. -- line height: 12
  710. -- part name: topic
  711.  
  712.  
  713. -- part 29 (field)
  714. -- low flags: 80
  715. -- high flags: 0002
  716. -- rect: left=317 top=132 right=162 bottom=448
  717. -- title width / last selected line: 0
  718. -- icon id / first selected line: 0 / 0
  719. -- text alignment: 0
  720. -- font id: 4
  721. -- text size: 9
  722. -- style flags: 0
  723. -- line height: 12
  724. -- part name: card id
  725.  
  726.  
  727. -- part 33 (button)
  728. -- low flags: 80
  729. -- high flags: A003
  730. -- rect: left=356 top=44 right=61 bottom=477
  731. -- title width / last selected line: 0
  732. -- icon id / first selected line: 0 / 0
  733. -- text alignment: 1
  734. -- font id: 0
  735. -- text size: 12
  736. -- style flags: 0
  737. -- line height: 16
  738. -- part name: Update Page Nos
  739. ----- HyperTalk script -----
  740. on mouseUp
  741.   global deletedCard
  742.   hide background button "Update Page Nos"
  743.   put the userLevel into currentLevel
  744.   set the userLevel to 5
  745.   set lockScreen to true
  746.   doMenu "New Field"
  747.   put the number of card fields into numFields
  748.   choose browse tool
  749.   set the style of card field numFields to shadow
  750.   put "Updating page numbers." & numToChar(13) & "Please wait..." into card field numFields
  751.   set lockScreen to false
  752.   send updatePageNumbers
  753.   send showFootnotes
  754.   updateBookmarks (the number of this card)
  755.   -- Actually, to be really consistent we should update ALL the
  756.   -- bookmarks here, so that when you Print Report they are all
  757.   -- correct.  However, bookmarks are not that important.
  758.   send showBookmarks
  759.   send updateContents to card "contents"
  760.   send updateIndex to card "index"
  761.   set lockScreen to true
  762.   choose field tool
  763.   click at the loc of card field numFields
  764.   doMenu "Clear Field"
  765.   choose browse tool
  766.   set lockScreen to false
  767.   set the userLevel to currentLevel
  768.   put "" into deletedCard
  769.   beep
  770. end mouseUp
  771.  
  772.